<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>取消延时执行</button>
</body>
<script>
    var btn =document.getElementById(btn)
    //可以执行一段代码
    setTimeout(function(){
        alert("3秒时间到！！！");
    },3000)
    //clearTimeout(id);
    //清除特定id的延迟执行
    btn.onclick = function(){
        clearTimeout(btn);
    }
    </script>
</html>